package com.laiketui.app.controller;

import com.laiketui.app.api.LiveBroadcastService;
import com.laiketui.domain.vo.MainVo;
import com.laiketui.root.annotation.HttpApiMethod;
import com.laiketui.core.domain.Result;
import com.laiketui.core.exception.LaiKeAPIException;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 直播
 *
 * @author Trick
 * @date 2020/12/16 16:37
 */
@RestController
@RequestMapping("/live")
public class LiveBroadcastController {

    @Autowired
    private LiveBroadcastService liveBroadcastService;

    @ApiOperation("直播列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roomId", value = "房间id", dataType = "string", paramType = "form")
    })
    @PostMapping("/getLiveList")
    @HttpApiMethod(urlMapping = {"app.liveBroadcast.getLiveList"})
    public Result getLiveList(MainVo vo, String roomId) {
        try {
            return Result.success(liveBroadcastService.getLiveBroadcastList(vo, roomId));
        } catch (LaiKeAPIException e) {
            return Result.error(e.getCode(), e.getMessage());
        }
    }

}
